package com.dmz.wxcp.wecom.wxbusiness.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dmz.wxcp.wecom.wxbusiness.entity.ArticleTags;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ArticleTagsMapper extends BaseMapper<ArticleTags> {
//    type 0是产品 1是学习 2是物流 3是加工

    @Select("select  * from articletags where type=#{type} order by clicktime desc limit 20")
    List<ArticleTags> getHotArticleTag(Integer type);

    @Select("select  * from articletags  where type=#{type} order by createtime desc limit 20")
    List<ArticleTags> getNewArticleTag(Integer type);

    @Update("update articletags set clicktime=clicktime+1 where tagname=#{tag}")
    Integer upDateClickTime(String tag);

    @Select("select * from articletags " +
            "where tagname=#{tag} and type=#{type}")
    ArticleTags  SelectCountNum(String tag, Integer type);

    Long InsertTag(@Param("tag") ArticleTags tag);

}
